/**
 * 计划基本信息
 */
import React from 'react';
import TitleLine from '../titleLine';
import './index.styl';
import moment from 'moment';

export default function PlanBasicMessage({ basicInfo, isCheckUser }) {
  return (
    <div className="planBasicMessage">
      <TitleLine title="计划基本信息" />
      <div className="planBasicMessage-content">
        {isCheckUser ? (
          <div className="planBasicMessage-content-first">
            <div>
              <span>计划名称:</span>
              <span>{basicInfo && basicInfo.name}</span>
            </div>
            <div>
              <span>执行时间:</span>
              <span>
                {basicInfo.time && moment(basicInfo.time[0]).format('YYYY-MM-DD')}至
                {basicInfo.time && moment(basicInfo.time[1]).format('YYYY-MM-DD')}
              </span>
            </div>
            <div>
              <span>创建时间:</span>
              <span>{basicInfo && moment(new Date()).format('YYYY-MM-DD HH:mm:ss')}</span>
            </div>
          </div>
        ) : (
          <div className="planBasicMessage-content-first">
            <div>
              <span>计划名称:</span>
              <span>{basicInfo && basicInfo.name}</span>
            </div>
            <div>
              <span>保养类型:</span>
              <span>{basicInfo && basicInfo.typeName}</span>
            </div>
            <div>
              <span>保养级别:</span>
              <span>{basicInfo && basicInfo.levelName}</span>
            </div>
            <div>
              <span>创建时间:</span>
              <span>{ basicInfo && basicInfo.createdTime || moment(new Date()).format('YYYY-MM-DD HH:mm:ss')}</span>
            </div>
          </div>
        )}

        <div className="planBasicMessage-content-second">
          <div>
            <span style={{float: 'left'}}>计划描述:</span>
            <div style={{float: 'left'}}>{basicInfo && basicInfo.remark}</div>
          </div>
        </div>
      </div>
    </div>
  );
}
